package com.zouxian.processor;

import us.codecraft.webmagic.Page;
import us.codecraft.webmagic.Site;
import us.codecraft.webmagic.Spider;
import us.codecraft.webmagic.processor.PageProcessor;

public class MyProcessor1 implements PageProcessor {
	// 配置
	private Site site = Site.
			me().
			setRetryTimes(3).//设置重复次数
			setSleepTime(100).//设置间隔
			setTimeOut(3000).//设置超时时间
			setRetryTimes(3);//设置重复次数

	public Site getSite() {
		// TODO Auto-generated method stub
		return site;
	}

	public void process(Page page) {
		System.out.println(page.getCharset());

	}

	public static void main(String[] args) {
		Spider.create(new MyProcessor1()).addUrl("https://www.baidu.com/").thread(3).start();
	}

}
